home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 December / PCWDEC06.iso / Software / Trial / Paint Shop Pro XI / Data1.cab / _75691A7DF22D4C869A168F332E54231C < prev    next >
Encoding:
Text File  |  2006-08-04  |  16.0 KB  |  417 lines

  1. from PSPApp import *
  2.  
  3. # Copyright 2006 Corel Software Inc., all rights reserved
  4. # This file contains utility routines provided by Corel Software.
  5. # This file contains all translatable strings for the bundled script files.
  6.  
  7. ScriptData = {}
  8.  
  9. class SaveSelection:
  10.     ''' define a helper class that can save any active selection to the alpha
  11.         channel and restore it later
  12.     '''
  13.     def __init__( self, Environment, Doc ):
  14.         ''' at init time we save the environment variable provided by PSP,
  15.             and if a selection exists we save it to an alpha channel
  16.         '''
  17.         self.Env = Environment
  18.         self.SavedSelection =  '__$TempSavedSelection$__'
  19.         self.IsSaved = 0
  20.         self.SavedOnDoc = Doc
  21.         
  22.         SelResult = App.Do( self.Env, 'GetRasterSelectionRect' )
  23.         if SelResult[ 'Type' ] != App.Constants.SelectionType.None:
  24.             # if there is a selection save it to the alpha channel
  25.             App.Do( self.Env, 'SelectSaveDisk', {
  26.                 'FileName': self.SavedSelection, 
  27.                 'Overwrite': App.Constants.Boolean.true, 
  28.                 'GeneralSettings': {
  29.                     'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  30.                     'AutoActionMode': App.Constants.AutoActionMode.Match
  31.                     }
  32.                 }, Doc)
  33.             self.IsSaved = 1    # set this so we know we saved one
  34.             
  35.             if SelResult[ 'Type' ] == App.Constants.SelectionType.Floating:
  36.                 # if the selection is floating promote it to a layer
  37.                 App.Do( self.Env, 'SelectPromote', {
  38.                         'KeepSelection': App.Constants.Boolean.false, 
  39.                         'LayerName': SelectionLayer, 
  40.                         'GeneralSettings': {
  41.                             'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  42.                             'AutoActionMode': App.Constants.AutoActionMode.Match
  43.                             }
  44.                         }, Doc)
  45.             else:
  46.                 App.Do( self.Env, 'SelectNone' )
  47.            
  48.             
  49.     def RestoreSelection( self ):
  50.         ''' if we have saved a selection, restore it now.  If we promoted
  51.             a floating selection to a layer we don't restore the selection
  52.             but don't attempt to mess with the layer in any way
  53.         '''
  54.         if self.IsSaved == 1:
  55.             # load the selection back from disk - this will replace any existing selection
  56.             App.Do( self.Env, 'SelectLoadDisk', {
  57.                     'FileName': self.SavedSelection, 
  58.                     'Operation': App.Constants.SelectionOperation.Replace, 
  59.                     'UpperLeft': App.Constants.Boolean.false, 
  60.                     'ClipToCanvas': App.Constants.Boolean.false, 
  61.                     'GreyMethod': App.Constants.CreateMaskFrom.Luminance, 
  62.                     'Invert': App.Constants.Boolean.false, 
  63.                     'GeneralSettings': {
  64.                         'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  65.                         'AutoActionMode': App.Constants.AutoActionMode.Match
  66.                         }
  67.                     }, self.SavedOnDoc)
  68.  
  69.     # end class SaveSelection
  70.  
  71. def NameFromMaterial( Material, Delimiter=' ', IncludeTexture=1 ):
  72.     ''' Given a material repository, return a name that describes it.
  73.         By default the name is delimited with space, but the delimiter
  74.         parameter can be used to override it.
  75.         By default textures are included in the name, but can be omitted
  76.         by setting the IncludeTexture parameter to 0
  77.     '''
  78.     TextureName = None
  79.     TypeName = ''
  80.     if Material is None:
  81.         CoreName = Null
  82.     else:
  83.         if Material[ 'Pattern' ] and \
  84.            (Material[ 'Pattern' ][ 'Name' ] or Material[ 'Pattern' ][ 'Image' ] ):
  85.             TypeName = Pattern
  86.             if Material[ 'Pattern' ][ 'Name' ]:
  87.                 CoreName = Material[ 'Pattern'  ][ 'Name' ]
  88.             else:
  89.                 CoreName = Inline
  90.         elif Material[ 'Gradient' ] and Material[ 'Gradient' ][ 'Name' ]:
  91.             TypeName = Gradient
  92.             GradType = {}
  93.             GradType[ App.Constants.GradientType.Linear ] = Linear
  94.             GradType[ App.Constants.GradientType.Rectangular ] = Rectangular
  95.             GradType[ App.Constants.GradientType.Radial ] = Radial
  96.             GradType[ App.Constants.GradientType.Angular ] = Sunburst
  97.             
  98.             CoreName = '%s%s%s' % ( Material[ 'Gradient' ][ 'Name' ], Delimiter, 
  99.                                     GradType[ Material[ 'Gradient' ][ 'GradientType' ] ] )
  100.         elif Material[ 'Art' ]:
  101.             TypeName = Art
  102.             CoreName = '%02x%02x%02x' % Material[ 'Art' ][ 'Color' ]
  103.         else:
  104.             TypeName = Solid
  105.             CoreName = '%02x%02x%02x' % Material[ 'Color' ]
  106.  
  107.         if Material[ 'Texture' ] and Material[ 'Texture' ][ 'Name' ]:
  108.             TextureName = Material[ 'Texture' ]['Name']
  109.  
  110.     if TextureName is not None and IncludeTexture != 0:
  111.         MaterialName = '%s%s%s%s%s' % ( TypeName, Delimiter, CoreName, Delimiter, TextureName )
  112.     else:
  113.         MaterialName = '%s%s%s' % ( TypeName, Delimiter, CoreName )
  114.  
  115.     return MaterialName
  116.  
  117. def IsNullMaterial( Material ):
  118.     ' check if the passed in material is none.  Returns true if null, false if non-null'
  119.     if Material is None:    
  120.         return App.Constants.Boolean.true   # material might be entirely none
  121.  
  122.     ArtIsNone = 0
  123.     ColorIsNone = 0
  124.     GradientIsNone = 0
  125.     PatternIsNone = 0
  126.     
  127.     if Material['Color'] is None:
  128.         ColorIsNone = 1
  129.  
  130.     if Material['Gradient'] is None or Material['Gradient']['Name'] is None:
  131.         GradientIsNone = 1
  132.  
  133.     if Material['Pattern'] is None or \
  134.        (Material['Pattern']['Name'] is None and Material['Pattern']['Image'] is None):
  135.         PatternIsNone = 1
  136.  
  137.     if Material['Art'] is None:
  138.         ArtIsNone = 1
  139.  
  140.     if ColorIsNone and GradientIsNone and PatternIsNone and ArtIsNone:
  141.         return App.Constants.Boolean.true   #it works out to none
  142.     else:
  143.         return App.Constants.Boolean.false
  144.  
  145.  
  146. def IsFlatImage( Environment, Doc ):
  147.     'Determine if Doc consists of a single background layer.  True if flat, false if not'
  148.     ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  149.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  150.  
  151.     if ImageInfo[ 'LayerNum' ] == 1 and LayerInfo[ 'IsBackground' ] == App.Constants.Boolean.true:
  152.         return App.Constants.Boolean.true
  153.     else:
  154.         return App.Constants.Boolean.false
  155.  
  156. def IsPaletted( Environment, Doc ):
  157.     '''Determine if the current image is paletted.  Greyscale is not counted as paletted
  158.        Returns true on paletted, false if not
  159.     '''
  160.     # these are all the paletted pixel formats
  161.     TargetFormats = [ App.Constants.PixelFormat.Index1, App.Constants.PixelFormat.Index4,
  162.                       App.Constants.PixelFormat.Index8 ]
  163.     
  164.     # are we paletted?
  165.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  166.  
  167.     if Info['PixelFormat'] in TargetFormats:
  168.         return App.Constants.Boolean.true
  169.     else:
  170.         return App.Constants.Boolean.false
  171.  
  172. def IsTrueColor( Environment, Doc ):
  173.     ''' Determine if the current image is true color.  Greyscale does not count
  174.         Returns true for true color, false for all others
  175.     '''
  176.     TargetFormats = [ App.Constants.PixelFormat.BGR, App.Constants.PixelFormat.BGRA ]
  177.     
  178.     # are we true color?
  179.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  180.     if Info['PixelFormat'] in TargetFormats:
  181.         return App.Constants.Boolean.true
  182.     else:
  183.         return App.Constants.Boolean.false
  184.  
  185. def IsGreyScale( Environment, Doc ):
  186.     ' Determine if the current image (not layer) is greyscale. True if it is, false otherwise'
  187.     TargetFormats = [ App.Constants.PixelFormat.Grey, App.Constants.PixelFormat.GreyA ]
  188.     
  189.     # are we true color?
  190.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  191.     if Info['PixelFormat'] in TargetFormats:
  192.         return App.Constants.Boolean.true
  193.     else:
  194.         return App.Constants.Boolean.false
  195.  
  196. def LayerIsArtMedia( Environment, Doc ):
  197.     'Returns true if the current layer is a artmedia layer'
  198.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  199.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.ArtMedia:
  200.         return App.Constants.Boolean.true
  201.     else:
  202.         return App.Constants.Boolean.false
  203.  
  204. def LayerIsRaster( Environment, Doc ):
  205.     'Returns true if the current layer is a raster layer'
  206.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  207.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Raster:
  208.         return App.Constants.Boolean.true
  209.     else:
  210.         return App.Constants.Boolean.false
  211.  
  212.  
  213. def LayerIsVector( Environment, Doc ):
  214.     'Returns true if the current layer is a vector layer'
  215.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  216.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Vector:
  217.         return App.Constants.Boolean.true
  218.     else:
  219.         return App.Constants.Boolean.false
  220.  
  221. def LayerIsBackground( Environment, Doc ):
  222.     'Returns true if the current layer is the background layer'
  223.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  224.     return LayerInfo[ 'IsBackground' ]
  225.     
  226.  
  227. def GetLayerCount( Environment, Doc ):
  228.     'Returns number of layers in Doc'
  229.     ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  230.     return ImageInfo[ 'LayerNum' ]    
  231.  
  232. def GetCurrentLayerName( Environment, Doc ):
  233.     'Returns the name of the current layer in Doc'
  234.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  235.     return LayerInfo[ 'General' ][ 'Name' ]
  236.  
  237. def PromoteToTrueColor( Environment, Doc ):
  238.     'If the current image type is paletted, promote it to true color.  Greyscale is left alone'
  239.     if IsPaletted( Environment, Doc ):
  240.         App.Do( Environment, 'IncreaseColorsTo16Million', {}, Doc )
  241.     return
  242.  
  243. def RequireADoc( Environment ):
  244.     '''Test that we actually have a target document, and put up a message box if we dont
  245.        Returns true if we have an open doc, false otherwise
  246.     '''
  247.     if App.TargetDocument is None:
  248.         App.Do( Environment, 'MsgBox', {
  249.                 'Buttons': App.Constants.MsgButtons.OK, 
  250.                 'Icon': App.Constants.MsgIcons.Stop, 
  251.                 'Text': RequiresOpenImage, 
  252.                 })
  253.         return App.Constants.Boolean.false
  254.     else:
  255.         return App.Constants.Boolean.true
  256.  
  257. # Begin Translatable Strings
  258. # BevelSelection.PspScript:
  259. LayerName_BevelSelection = u"Dreidimensionale Auswahl"
  260.  
  261. # Black and white pencil.PspScript:
  262. LayerName_Blackandwhitepencil = u"Raster 2"
  263.  
  264. # Border with drop shadow.PspScript:
  265. AlphaName = u"Selection #1"
  266.  
  267. # Flag.PspScript:
  268. #AlphaName = u"Selection #1"
  269.  
  270. # Grey chart.PspScript:
  271. GradientName = u"Vordergrund - Hintergrund"
  272.  
  273. # Sloppy edges.PspScript:
  274. #AlphaName = u"Selection #1"
  275.  
  276. # Toned greyscale.PspScript:
  277. LayerName_Tonedgreyscale = u"Farbabgleich 1"
  278.  
  279. # Vignette.PspScript:
  280. LayerName_Vignette = u"Raster 2"
  281.  
  282. # Photo edges.PspScript:
  283. LayerName_Photoedges = u"Raster 2"
  284.  
  285. # SimpleCaption.PspScript:
  286. ImageTooSmallMsg = u"Das aktuell ausgewΣhlte Bild ist zu klein fⁿr eine Beschriftung - die Gr÷▀e muss mindestens 20 x 20 cm betragen."
  287. MultipleLayersMsg = u"Das aktuell ausgewΣhlte Bild verfⁿgt ⁿber mehrere Ebenen. Dadurch kann es zu unerwarteten Ergebnissen kommen.\nDie Ebenen sollten vor dem Fortfahren zusammengefasst werden. M÷chten Sie die Ebenen zusammenfassen?"
  288. CaptionPrompt = u"Geben Sie eine Beschriftung fⁿr das Bild ein. Diese wird zentriert unterhalb des Bildes angezeigt."
  289. CaptionTitle = u"Bildbeschriftung eingeben"
  290. PromotedLayerName = u"Bild"
  291. PageSurfaceLayerName = u"SeitenoberflΣche"
  292. AlbumPageLayerGroup = u"Albumseite"
  293. DropShadowLayerName = u"Schlagschatten"
  294. CaptionTextLayerName = u"Beschriftungstext"
  295. CaptionFontName2 = u"Tahoma" 
  296.  
  297. # VectorMergeAndCutoutSelected.PspScript:
  298. TwoOrMoreMsg = u"Fⁿr dieses Skript mⁿssen mindestens zwei Vektorobjekte ausgewΣhlt sein." 
  299.  
  300. # VectorMergeSelected.PspScript:
  301. #TwoOrMoreMsg = u"This script requires that two or more vector objects be selected."
  302.  
  303. # AddPSP8FileLocations.PspScript:
  304. NoPSP8FoldersFound = u"Es wurden keine PSP8-Ordner gefunden."
  305. FilesHaveBeenAdded = u"Die in '%s' enthaltenen Dateien wurden zu den Speicherorteinstellungen hinzugefⁿgt."
  306. Brushes = u"Pinsel"
  307. BumpMaps = u"Bumpmaps"
  308. DeformationMaps = u"Deformationsdaten"
  309. DisplacementMaps = u"Verschiebungsabbildung"
  310. EnvironmentMaps = u"Umgebungsabbildungen"
  311. Gradients = u"FarbverlΣufe"
  312. Masks = u"Masken"
  313. Palettes = u"Paletten"
  314. Patterns = u"Muster"
  315. PictureFrames = u"Bilderrahmen"
  316. PictureTubes = u"Bildstempel"
  317. PresetShapes = u"Formen"
  318. Presets = u"Voreinstellungen"
  319. PrintTemplates = u"Druckvorlagen"
  320. QuickGuides = u"Quick Guides"
  321. SampleImages = u"Beispielbilder"
  322. ScriptsRestricted = u"Skripts (eingeschrΣnkt)"
  323. ScriptsTrusted = u"Skripts (vertrauenswⁿrdig)"
  324. Selections = u"Auswahl"
  325. StyledLines = u"Linienstilarten"
  326. Swatches = u"Farbfelder"
  327. Textures = u"Texturen"
  328.  
  329. # AddPSP8FileLocationsALL.PspScript:
  330. #NoPSP8FoldersFound = u"No PSP8 folders found."
  331. #FilesHaveBeenAdded = u"Files in '%s' have been added to the File Locations preferences."
  332. #Brushes = u"Brushes"
  333. #BumpMaps = u"Bump Maps"
  334. #DeformationMaps = u"Deformation Maps"
  335. #DisplacementMaps = u"Displacement Maps"
  336. #EnvironmentMaps = u"Environment Maps"
  337. #Gradients = u"Gradients"
  338. #Masks = u"Masks"
  339. #Palettes = u"Palettes"
  340. #Patterns = u"Patterns"
  341. #PictureFrames = u"Picture Frames"
  342. #PictureTubes = u"Picture Tubes"
  343. #PresetShapes = u"Preset Shapes"
  344. #Presets = u"Presets"
  345. #PrintTemplates = u"Print Templates"
  346. #QuickGuides = u"Quick Guides"
  347. #SampleImages = u"Sample Images"
  348. #ScriptsRestricted = u"Scripts-Restricted"
  349. #ScriptsTrusted = u"Scripts-Trusted"
  350. #Selections = u"Selections"
  351. #StyledLines = u"Styled Lines"
  352. #Swatches = u"Swatches"
  353. #Textures = u"Textures"
  354.  
  355. # CapturePalette.PspScript:
  356. RequiresPaletted = u"Fⁿr dieses Skript ist ein Palettenbild erforderlich. M÷chten Sie die Farbtiefe reduzieren?"
  357. NoPaletteFound = u"Interner Fehler: Keine Palette gefunden"
  358. GroutWidthMsg = u"Der Wert fⁿr die Fugenbreite muss zwischen 0 und 20 liegen"
  359. ColorsPerRowMsg = u"Der Wert fⁿr die Farben pro Reihe muss zwischen 1 und 100 liegen"
  360. TileSizeMsg = u"Der Wert fⁿr die Kachelgr÷▀e muss zwischen 2 und 50 liegen"
  361. NumColorsMsg = u"Der Wert fⁿr die Anzahl der Farben muss zwischen 2 und 1024 liegen"
  362. ButtonMarginMsg = u"Der Wert fⁿr den SchaltflΣchenrand muss weniger als die HΣlfte der Kachelgr÷▀e betragen"
  363. ColorIs = u"Farbe %d ist (%02X,%02X,%02X)"
  364.  
  365. # EXIFCaptioning.PspScript:
  366. NoEXIFData = u"Auf dem aktuell ausgewΣhlten Bild wurden keine EXIF-Daten gefunden."
  367. ExposureMsg = u"f/%g Blende, %s Belichtung"
  368. CaptionBackground = u"Hintergrund fⁿr Beschriftung"
  369. EXIFCaption = u"EXIF-Beschriftung"
  370. EXIFText = u"EXIF-Text"
  371. CaptionFontName = u"Arial"
  372.  
  373. # SplitCMYKtoLayerGroup.PspScript:
  374. Black = u"Schwarz"
  375. BlackChannel = u"Schwarz-Kanal"
  376. Yellow = u"Gelb"
  377. YellowChannel = u"Gelb-Kanal"
  378. Magenta = u"Magenta"
  379. MagentaChannel = u"Magenta-Kanal"
  380. Cyan = u"Zyan"
  381. CyanChannel = u"Zyan-Kanal"
  382. CMYKChannels = u"CMYK-KanΣle"
  383.  
  384. # SplitHSLtoLayerGroup.PspScript:
  385. Lightness = u"Helligkeit"
  386. LightnessChannel = u"Helligkeits-Kanal"
  387. Saturation = u"SΣttigung"
  388. SaturationChannel = u"SΣttigungs-Kanal"
  389. Hue = u"Farbton"
  390. HueChannel = u"Farbton-Kanal"
  391. HSLChannels = u"HSL-KanΣle"
  392.  
  393. # SplitRGBtoLayerGroup.PspScript:
  394. Blue = u"Blau"
  395. BlueChannel = u"Blau-Kanal"
  396. Green = u"Grⁿn"
  397. GreenChannel = u"Grⁿn-Kanal"
  398. Red = u"Rot"
  399. RedChannel = u"Rot-Kanal"
  400. RGBChannels = u"RGB-KanΣle"
  401.  
  402. # JascUtils.py, PSPUtils.py
  403. SelectionLayer = u"Auswahl ⁿber Skript umgewandelt"
  404. Pattern = u"Muster"
  405. Inline = u"Inline"
  406. Gradient = u"Farbverlauf"
  407. Linear = u"Linear"
  408. Radial = u"Strahlenf÷rmig"
  409. Rectangular = u"Rechteckig"
  410. Sunburst = u"Nova"
  411. Solid = u"Farbig"
  412. Null = u"Null"
  413. Art = u"Kunst"
  414. RequiresOpenImage = u"Fⁿr dieses Skript muss ein Bild ge÷ffnet sein."
  415. # End Translatable Strings
  416.  
  417.